<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <%@ include file="/common/plateform/include/common-base.jsp"%>
  <title>快速开发平台</title>
</head>
<body class="${sysColor} sidebar-collapse">
<div class="wrapper">
  <!-- top start -->
    <header class="main-header">
        <!-- Logo -->
        <a href="#" class="logo" style="position:relative;">
            <!-- mini logo for sidebar mini 50x50 pixels -->
            <span class="logo-mini"><img src="${ctx}/common/plateform/img/mini_logo.png" width=50 height=50 /></span>
            <!-- logo for regular state and mobile devices -->
            <span class="logo-lg"> <img src="${ctx}/common/plateform/img/plateform_logo.png" width=205 height=50 /></span>
            <!-- IUS快速开发平台	 -->
        </a>
        <!-- Header Navbar: style can be found in header.less -->
        <nav class="navbar navbar-static-top">
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <li class="dropdown user user-menu">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <img src="${ctx}/images/plateform/person2.png" class="user-image"/>
                            <span class="hidden-xs">${loginUser.userCname}</span>
                        </a>
                        <ul class="dropdown-menu">
                            <!-- User image -->
                            <li class="user-header">
                                <img src="${ctx}/images/plateform/person2.png" class="img-circle"/>
                                <p>
                                    ${loginUser.userCname}
                                    <small>${loginUser.userEname }</small>
                                </p>
                            </li>
                            <!-- Menu Body -->
                            <!-- Menu Footer-->
                            <li class="user-footer">
                                <div class="pull-left">
                                    <a href="http://www.iussoft.com/" target="_blank" class="btn btn-default btn-flat">IUS官网</a>
                                </div>
                                <div class="pull-right">
                                    <a href="${ctx}/logout?go=/" class="btn btn-default btn-flat">退出</a>
                                </div>
                            </li>
                        </ul>
                    </li>

                </ul>
            </div>
        </nav>
    </header>
  <!-- top end -->

    <div class="wrapper" style="background-color:#f7f7f7;">
        <div class="content">
            <div class="row">
                <div  style="padding:15px 150px;">
                    <h3 style="padding-bottom: 20px;">用户信息登记</h3>
                    <div class="panel">
                        <div class="panel-heading text-center link-muted p30" style="border-bottom:1px solid #e6e7ea; ">
                            <div class="col-lg-12 text-center">
                                <h5 class="col-lg-offset-1 col-lg-3">
                                    ① 帐号信息
                                </h5>
                                <h5 class="col-lg-1"> - </h5>
                                <h5 class="col-lg-3 text-danger">
                                    ② 信息登记
                                </h5>
                                <h5 class="col-lg-1"> - </h5>
                                <h5 class="col-lg-3">
                                    ③ 信息审核
                                </h5>
                            </div>
                        </div>
                        <div class="panel-body" id="table1">
                            <!-- 注册内容主体 start -->
                            <div class="col-lg-12">
                                <div class="panel" id="panel-step-1">
                                    <div class="panel-body">
                                        <div class="form-group">
                                            <div class="col-lg-12 lh24">
                                                <p>
                                                    IUS开放平台致力于打造真实、合法、有效的技术平台。为了更好的保障你和广大用户的合法权益，请你认真填写一下登记信息。
                                                </p>
                                                <p class="pt10">
                                                <ul>
                                                    <li>用户信息登记审核通过后：</li>
                                                    <li>1）你可以依法享受本平台所产生的相关权益；</li>
                                                    <li>2）你将对本平台所有行为操作承担全部责任；</li>
                                                    <li>3）你的注册信息将在法律允许的范围内想广大用户展示；</li>
                                                </ul>
                                                </p>
                                                <p class="pt10 pb30">
                                                    请确认你的账号主体类型，并请按照对应类别进行信息登记。
                                                </p>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-lg-12">
                                                <div class="col-lg-6 user-type" data-usertype-val="person">
                                                    <i class="fa fa-user"></i>
                                                    <h2>个人</h2>
                                                </div>
                                                <div class="col-lg-6 user-type" data-usertype-val="org">
                                                    <i class="fa fa-bank"></i>
                                                    <h2>企业</h2>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-lg-12 p20">
                                                <div class="col-lg-12 text-right">
                                                    <button type="button" class="btn btn-sm btn-warning" style="width:120px;" onclick="nextStep1()"> 下一步 </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="panel hidden" id="panel-step-2">
                                    <div class="panel-heading">
                                        <a href="javascript:;" onclick="showStep(1,2)">上一步</a>
                                    </div>
                                    <div class="panel-body">

                                        <div id="div-user-type-org" class="hidden">
                                            <form class="form-horizontal" role="form" name="form-org" id="form-org" action="javascript:void(0)">
                                                <input type="hidden" name="formToken" id="formToken" value="${formToken}">
                                                <input type="hidden" name="pageName"  value="user-list"/>
                                                <input type="hidden" name="formName"  value="editForm"/>
                                                <input type="hidden" name="uctUser.certType" value="zzjgdmz"/>
                                                <input type="hidden" name="uctUser.customerType" value="org"/>
                                                <input type="hidden" name="uctUser.auditStatus" value="10"/><!-- 审核状态待审核：10待审核 ；91审核通过；90审核不通过-->
                                                <input type="hidden" name="uctUser.w_userId" value="${loginUser.userId}"/>
                                                <div class="form-group col-sm-12">
                                                    <div class="col-sm-3 control-label text-right">用户账号：</div>
                                                    <div class="col-sm-9  form-control-static">
                                                        <span>${loginUser.userEname}</span>
                                                    </div>
                                                </div>
                                                <div class="form-group col-sm-12">
                                                    <div class="col-sm-3 control-label text-right">用户类别：</div>
                                                    <div class="col-sm-9  form-control-static">企业</div>
                                                </div>
                                                <div class="form-group col-sm-12">
                                                    <div class="col-sm-3 control-label text-right">企业名称：</div>
                                                    <div class="col-sm-6">
                                                        <input type="text" class="form-control clean"  maxlength="50" name="uctUser.userCname" placeholder="请输入企业名称"
                                                               data-bv-notempty="true" data-bv-notempty-message="必填项，请输入企业名称"/>
                                                    </div>
                                                    <div class="col-sm-offset-3 col-sm-9 link-muted">
                                                        需与当地政府颁发的商业许可证或其他合法证件上的企业名称完全一致。信息审核成功后，名称不可修改。
                                                    </div>
                                                </div>
                                                <div class="form-group col-sm-12">
                                                    <div class="col-sm-3 control-label text-right">营业执照注册号：</div>
                                                    <div class="col-sm-6">
                                                        <input type="text" class="form-control clean"  maxlength="18" name="uctUser.certNo" placeholder="请输入企业证件号码"
                                                               data-bv-notempty="true" data-bv-notempty-message="必填项，请输入企业证件号码" data-bv-regexp="true" data-bv-regexp-regexp="^(([a-zA-Z0-9]{15})|([a-zA-Z0-9]{18}))$" data-bv-regexp-message="证件号码格式有误"/>
                                                    </div>
                                                    <div class="col-sm-offset-3 col-sm-9 link-muted">
                                                        请输入15位营业执照注册号或18位的统一社会信用代码。
                                                    </div>
                                                </div>
                                                <div class="form-group col-sm-12">
                                                    <div class="col-sm-3 control-label text-right">联系邮箱：</div>
                                                    <div class="col-sm-6">
                                                        <input type="text" class="form-control clean"  maxlength="30" name="uctUser.email" placeholder="请输入联系人邮箱地址" data-bv-notempty="true" data-bv-notempty-message="必填项，请输入邮箱地址" data-bv-regexp="true" data-bv-regexp-regexp="^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$" data-bv-regexp-message="邮箱格式有误"/>
                                                    </div>
                                                    <div class="col-sm-offset-3 col-sm-9 link-muted">
                                                        请输入真实有效的邮箱地址。
                                                    </div>
                                                </div>
                                                <div class="form-group col-sm-12 p30">
                                                    <div class="form-group text-center" >
                                                        <button type="button" onclick="saveUserInfo('form-org')"  class="btn btn-warning btn-lg" style="width:300px;">完成登记</button>
                                                    </div>
                                                </div>
                                            </form>
                                        </div>

                                        <div id="div-user-type-person" class="hidden">
                                            <form class="form-horizontal" role="form" name="form-org" id="form-person" action="javascript:void(0)">
                                                <input type="hidden" name="formToken" id="formToken-person" value="${formToken}">
                                                <input type="hidden" name="pageName"  value="user-list"/>
                                                <input type="hidden" name="formName"  value="editForm"/>
                                                <input type="hidden" name="uctUser.certType" value="sfz"/>
                                                <input type="hidden" name="uctUser.customerType" value="person"/>
                                                <input type="hidden" name="uctUser.auditStatus" value="10"/><!-- 审核状态待审核：10待审核 ；91审核通过；90审核不通过-->
                                                <input type="hidden" name="uctUser.w_userId" value="${loginUser.userId}"/>
                                                <div class="form-group col-sm-12">
                                                    <div class="col-sm-3 control-label text-right">用户账号：</div>
                                                    <div class="col-sm-9  form-control-static">
                                                        <span>${loginUser.userEname}</span>
                                                    </div>
                                                </div>
                                                <div class="form-group col-sm-12">
                                                    <div class="col-sm-3 control-label text-right">用户类别：</div>
                                                    <div class="col-sm-9  form-control-static">个人</div>
                                                </div>
                                                <div class="form-group col-sm-12">
                                                    <div class="col-sm-3 control-label text-right">个人名称：</div>
                                                    <div class="col-sm-6">
                                                        <input type="text" class="form-control clean"  maxlength="50" name="uctUser.userCname" placeholder="请输入个人真实名称"  data-bv-notempty="true" data-bv-notempty-message="必填项，请输入个人真实名称"/>
                                                    </div>
                                                    <div class="col-sm-offset-3 col-sm-9 link-muted">
                                                        需与身份证上姓名完全一致。
                                                    </div>
                                                </div>
                                                <div class="form-group col-sm-12">
                                                    <div class="col-sm-3 control-label text-right">身份证号码：</div>
                                                    <div class="col-sm-6">
                                                        <input type="text" class="form-control clean"  maxlength="18" name="uctUser.certNo" placeholder="请输入个人证件号码" data-bv-notempty="true" data-bv-notempty-message="必填项，请输入个人证件号码" data-bv-regexp="true" data-bv-regexp-regexp="^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$" data-bv-regexp-message="身份证号码格式有误"/>
                                                    </div>
                                                    <div class="col-sm-offset-3 col-sm-9 link-muted">
                                                        请输入身份证完整的身份证号码。
                                                    </div>
                                                </div>
                                                <div class="form-group col-sm-12">
                                                    <div class="col-sm-3 control-label text-right">联系邮箱：</div>
                                                    <div class="col-sm-6">
                                                        <input type="text" class="form-control clean"  maxlength="30" name="uctUser.email" placeholder="请输入联系人邮箱地址" data-bv-notempty="true" data-bv-notempty-message="必填项，请输入邮箱地址" data-bv-regexp="true" data-bv-regexp-regexp="^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$" data-bv-regexp-message="邮箱格式有误"/>
                                                    </div>
                                                    <div class="col-sm-offset-3 col-sm-9 link-muted">
                                                        请输入真实有效的邮箱地址。
                                                    </div>
                                                </div>
                                                <div class="form-group col-sm-12 p30">
                                                    <div class="form-group text-center" >
                                                        <button type="button" onclick="saveUserInfo('form-person')"  class="btn btn-warning btn-lg" style="width:300px;">完成登记</button>
                                                    </div>
                                                </div>
                                            </form>
                                        </div>

                                    </div>
                                </div>
                            </div>
                            <!-- 注册内容主体 end -->
                        </div>
                    </div>
                </div>

            </div>




        </div>
    </div>

  <!-- foot start -->
  <%@include file="/common/plateform/foot.jsp" %>
  <!-- foot start -->
  
</div>

</body>
</html>


<script>
    var clickMenu= 'plateForm-index';
    var customerType = "";

    $(".user-type").click(function () {
        customerType= $(this).attr("data-usertype-val");
        $(this).siblings().removeClass("user-type-active");
        $(this).addClass("user-type-active");
        $("input[type='radio'][name='uctUser.customerType'][value='"+customerType+"']").prop('checked',true);
    });
    function nextStep1(){
        if(customerType==null|| customerType==""|| customerType==undefined){
            layer.msg('请先选择账号主体类型！');
            return;
        }
        showStep(2,1);

        var formId = "#form-"+customerType;
        /** $.getJSON('${ctx}/sendPage/token?token=true',function(myData){
            $(formId).find("input[name='formToken']").val(myData);
		})**/
        //控制显示和注入校验规则
        if("org"==customerType){
            $("#div-user-type-org").removeClass("hidden");
            $("#div-user-type-person").addClass("hidden");
        }else{
            $("#div-user-type-person").removeClass("hidden");
            $("#div-user-type-org").addClass("hidden");
        }
        setValidate(formId);
    }

    function showStep(t1,t2){
        $("#panel-step-"+t1).removeClass("hidden");
        $("#panel-step-"+t2).addClass("hidden");
    }
    //回车
    document.onkeydown=function mykeyDown(e){
        //compatible IE and firefox because there is not event in firefox
        e = e||event;
        if(e.keyCode == 13) {return}
        return;
    };
    //提交注册操作
    function saveUserInfo(formId){
        //1.校验规则-表单提交时触发
        var validate = $('#'+formId).data('bootstrapValidator').validate();
        if(!validate.isValid()){ //如果校验不通过
            return;
        }
        var index_submit = layer.confirm('您确定要提交信息吗？', {btn: ['是','否'],closeBtn: 0,offset: '220px'}
            , function(){
                layer.close(index_submit);
                var index_load = layer.load(1, {shade: false});
                $.ajax({
                    url:ctx+"/trans/submit/",
                    data:$("#"+formId).serialize(),
                    dataType:'json',type:'post',
                    success:function(myData){
                        layer.close(index_load);
                        console.log(myData);
                        if(myData.flag=="T"){
                            var index_loginout = layer.confirm("用户信息登记成功，请退出进行重新登录！",{btn: ['是','否'],closeBtn: 0,offset: '220px'},function(){
                                window.location.href = "${ctx}/logout?go=${ctx}/";
                                // loginout();
                            });

                        }else{
                            layer.alert("用户信息登记失败！", {offset: '200px'});
                        }
                    }
                });
            });
    }

    //1.校验规则-定义
    function setValidate(formId){
        $(formId).bootstrapValidator({
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            }, /** 以下需要结合实际业务清空补充个表单元素的验证规则 **/
            fields: {
            }
        });
    }

</script>


